#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
const ll N = 5e5 + 45;
const ll mod = 998244353;
ll ksm(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans = ans * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ans % mod;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll t;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        vector<ll> a(n + 2);
        for (ll i = 1; i <= n; i++)
            cin >> a[i];
        ll ans = 1;
        vector<ll> b;
        for (ll i = n - 1; i >= 1; i--)
        {
            if (a[i + 1] % a[i] == 0)
                continue;
            else
            {
                b.push_back(a[i] / __gcd(a[i], a[i + 1]));
            }
        }
        if (b.size() == 0)
            cout << 91 << endl;
        else
        {
            ll ans = 0;
            for (auto j : b)
            {
                if (ans == 0)
                    ans = j;
                else
                {
                    ll u = __gcd(ans, j);
                    ans = ans * j / u;
                }
            }
            cout << ans << endl;
        }
    }
}
